package demo2;

class Student{
    public String name;
    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                '}';
    }
    public boolean equals(Object obj) {
        Student student =(Student) obj;
        if(this.name.equals(student.name)){
            return true;
        }
        return false;
    }
}
public class Test2 {
    public static void main(String[] args) {
        Student student = new Student();
        student.name = "zhangsan";

        Student student2 = new Student();
        student2.name = "zhangsan";
        boolean flg = student.equals(student2);
        System.out.println("flg:"+flg);
    }
}


